<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增')"/>
    <th:block th:include="include :: select2-css"/>
</head>
<body>
<div class="main-content">
    <form id="form-work-add" class="form-horizontal" AUTOCOMPLETE="OFF">
        <input id="eid" name="eid" class="form-control" type="hidden"/>
        <h4 class="form-header h4">基本信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">工号：</label>
                    <div class="col-sm-8">
                        <input id="badge" name="badge" placeholder="选择员工" class="form-control" type="text"
                               onclick="getEmp()" required />
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">姓名：</label>
                    <div class="col-sm-8">
                        <input id="name" name="name" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">公司名称：</label>
                    <div class="col-sm-8">
                        <input id="compName" name="compName" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">部门名称：</label>
                    <div class="col-sm-8">
                        <input id="depName" name="depName" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">岗位名称：</label>
                    <div class="col-sm-8">
                        <input id="jobName" name="jobName" class="form-control" readonly="readonly" type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <h4 class="form-header h4">新增信息</h4>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">开始时间：</label>
                    <div class="col-sm-8">
                        <input id="BeginDate" name="BeginDate"  class="form-control laydate-demo-1"  type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">结束时间：</label>
                    <div class="col-sm-8">
                        <input id="EndDate" name="EndDate"  class="form-control laydate-demo-2"  type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">工作单位：</label>
                    <div class="col-sm-8">
                        <input id="Company" name="Company"  class="form-control"  type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">担任职务：</label>
                    <div class="col-sm-8">
                        <input id="Job" name="Job" class="form-control"  type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">工作地点：</label>
                    <div class="col-sm-8">
                        <input id="WorkPlace" name="WorkPlace"  class="form-control"  type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">证明人：</label>
                    <div class="col-sm-8">
                        <input id="Reference" name="Reference"  class="form-control"  type="text"/>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">联系方式：</label>
                    <div class="col-sm-8">
                        <input id="Tel" name="Tel"  class="form-control"  type="text"/>
                    </div>
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label class="col-sm-4 control-label">是否海外：</label>
                    <div class="col-sm-8">
                        <select name="isout" id="isout" class="form-control m-b">
                            <option value="">请选择</option>
                            <option value="0">否</option>
                            <option value="1">是</option>
                        </select></div>
                </div>
            </div>
        </div>
    </form>
</div>


<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js"/>
<th:block th:include="include :: datetimepicker-js"/>

<script th:inline="javascript">

    var prefix = ctx + "bgInfo/work";

    $(function () {
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-1',
                type: 'date'
            });
        });
        layui.use('laydate', function () {
            var laydate = layui.laydate;
            laydate.render({
                elem: '.laydate-demo-2',
                type: 'date'
            });
        });

    });


    function submitHandler() {
        if ($.validate.form()) {
            var data = $("#form-work-add").serializeArray();
            var eid = $("#eid").val();
            var BeginDate = $("#BeginDate").val();
            var EndDate = $("#EndDate").val();
            var Company = $("#Company").val();
            var Job = $("#Job").val();
            var WorkPlace = $("#WorkPlace").val();
            var Reference = $("#Reference").val();
            var Tel = $("#Tel").val();
            var isout = $("#isout").val();
            data.push({"name": "eid", "value": eid});
            data.push({"name": "BeginDate", "value": BeginDate});
            data.push({"name": "EndDate", "value": EndDate});
            data.push({"name": "Company", "value": Company});
            data.push({"name": "Job", "value": Job});
            data.push({"name": "WorkPlace", "value": WorkPlace});
            data.push({"name": "Reference", "value": Reference});
            data.push({"name": "Tel", "value": Tel});
            data.push({"name": "isout", "value": isout});
            $.operate.save(prefix + "/add", data);
        }
    }

    function getEmp() {
        $.modal.open("选择添加工作经历人员", ctx + "bgInfo/getEmp");
    }

</script>
</body>
</html>
